<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="my" uri="/mytags" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>通知公告信息</title>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/asserts/bootstrap-3.3.7-dist/css/bootstrap.min.css"/>
	   <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/wangEditor-3.0.16/release/wangEditor.min.css"/>
 
		<!-- js插件 -->
		<script src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></script>
		<script src="${pageContext.request.contextPath}/asserts/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/asserts/bootstrapValidate/css/bootstrapValidator.min.css"/>
 	    <script src="${pageContext.request.contextPath}/asserts/bootstrapValidate/js/bootstrapValidator.min.js"></script>
		<script src="${pageContext.request.contextPath}/js/wangEditor-3.0.16/release/wangEditor.min.js"></script>
 		<style type="text/css">
 			button{
 				height:30px;
 			}
 			.btn{
 				height:30px;
 			}
 		</style>
 	</head>
	<body>
			<!-- 内容展示区 -->
			<div >
					<!-- 导航 -->
					<ol class="breadcrumb">
						<li><i class="fa fa-comment"></i> 通知公告</li>
					</ol>
					<div class="container-fluid">
						<!-- 	内容面板 -->
						<div class="panel panel-default">
							<!-- 控制按钮 -->
							<div class="panel-heading">
									<div class="btn-group">
										<button class="btn btn-primary"  type="button" onclick="addNotice()" ><span class="glyphicon glyphicon-pencil"></span>发布公告</button>
 
									
									</div>
									
							</div><!-- 控制按钮  end-->
							<div class="panel-body">
							<form action="${pageContext.request.contextPath}/notice/list" method="post"  class="form-horizontal" >
										<div class="form-group"  style="margin-top:10px">
											<label class="control-label col-md-2">标题：</label>
											<div class="col-md-6">
												 		<input type="text" name="name" value="${name}" id="name"
												placeholder="输入标题" class="form-control" />
									
											</div>
											<div class="col-md-2  form-group">
												<button class="btn btn-success"  type="submit">查询</button>
											</div>
										</div>
									</form>
								<table class="table table-bordered table-striped table-condensed table-hover">
									<tr>
										<th style="display:none" width="5%"><input type="checkbox" name="" id="selectAll" /></th>
										<th width="2%">ID</th>
										<th width="10%">公告标题</th>
										<!-- <th width="20%">公告内容</th> -->
										<th width="10%">文件地址(可下载)</th>
										<th width="10%">上传时间</th>
										<th width="10%">操作</th>
									</tr>
									<!-- 数据绑定 -->
									<c:forEach items="${pageInfo.list}" var="notice">
									<tr>
									 
										<td>${notice.id}</td>
										<td>${notice.name}</td>
										<%-- <td>
										<c:if test="${fn:length(notice.content)>20}">
											${fn:substring(notice.content,0,19)}...
										</c:if>
										<c:if test="${fn:length(notice.content)<=20}">
											${notice.content}
										</c:if>
										</td> --%>
										<td><a href="javascript:void(0);" onclick="downInfo(${notice.id})" title="下载资料">${notice.filepath}</a></td>
 										<td> <fmt:formatDate value="${notice.createdate}" pattern="yyyy-MM-dd hh:mm:ss"/></td>
 										
										<td>
											 
											 <button type="button" class="btn btn-danger" onclick="del(${notice.id})"> 
											 	<span class="glyphicon glyphicon-remove"></span>删除</button>
											  
											 	 <a class="btn btn-info" target="_blank" href="detailnotice?id=${notice.id}"> 
											 	<span class="glyphicon glyphicon-list"></span>详情</a>
											 		 
										
										
											 	 <button type="button" class="btn btn-success" > 
											 	<span class="glyphicon glyphicon-list"></span>已读人员</button>
										</td>
									</tr>
									</c:forEach>	
									 
									<!-- 	数据绑定 end -->
								</table>
								<!-- 	分页 -->
								<!-- 	分页 -->
								 <my:page prePage="${pageInfo.prePage}" nextPage="${pageInfo.nextPage}"  
								  url="${pageContext.request.contextPath}/notice/list?n=1" totalPage="${pageInfo.pages}"
								  currentPage="${pageInfo.pageNum}"/>
							</div>
						</div><!-- 内容面板 end -->
					</div>
			</div><!-- 	内容展示区 end-->
	 
		
		 
		
		
		 
	 
	</body>

<script>

function downInfo(id){
	
	// alert(id);
	 location.href="downFile?id="+id+"&d="+Math.random();
}
 
function del(id){
 	  var flag =  confirm("确认是否删除？");
 	   if(flag){
 		   var path  ='${pageContext.request.contextPath}';
 		   //alert(id);
 		    location.href= path+"/notice/delete?id="+id;
 	   }
}
 
function addNotice(){
	  var path  ='${pageContext.request.contextPath}';
	   //alert(id);
	    location.href= path+"/addnotice.jsp";
}
 
 
   
/*    document.documentElement.style.overflowY = 'hidden';
  */
</script>
</html>